﻿using SX.Utils.Log.log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SX.Utils
{
    public static class ESHelp
    {
        private static readonly ILog L = LogManager.GetLogger(typeof(ESHelp));
        public static string ESURL {
            get {
                return ConfigHelper.GetConn("ESURL");
            }
        }
        public static void AddStringData(string index, string type, string id, string data)
        {
            var result = EasyHttp.With(string.Format("{0}/{1}/{2}/{3}", ESURL.Trim('/'), index, type, id))
                .PutForJsonStringData(data);
            L.Debug(result);
        }
        public static void Add(string index, string type, string id,object  data) {
            var result = EasyHttp.With(string.Format("{0}/{1}/{2}/{3}", ESURL.Trim('/'), index, type, id))
                .PutForJson(data);
            L.Debug(result);
        }
    }
}
